using System;
using System.IO;

class RightAnglePreview
{
    static void Main()
    {
        // 创建SVG文件来预览直角连接线
        string svg = GenerateRightAngleConnectionSvg();
        File.WriteAllText("RightAnglePreview.svg", svg);
        Console.WriteLine("SVG预览已生成: RightAnglePreview.svg");
        Console.WriteLine("您可以使用任何浏览器或SVG查看器打开此文件来查看直角连接线效果");
    }

    static string GenerateRightAngleConnectionSvg()
    {
        // 模拟节点连接的两个端点
        int startX = 100, startY = 100;
        int endX = 400, endY = 300;
        
        // 计算直角连接线的中点
        int midPointX = (startX + endX) / 2;
        
        // 生成SVG内容
        return $@"<?xml version=""1.0"" encoding=""UTF-8""?>
<svg width=""500"" height=""400"" xmlns=""http://www.w3.org/2000/svg">
    <!-- 背景网格 -->
    <defs>
        <pattern id=""grid"" width=""50"" height=""50"" patternUnits=""userSpaceOnUse"">
            <path d=""M 50 0 L 0 0 0 50"" fill=""none"" stroke=""#CCCCCC"" stroke-width=""0.5""/>
        </pattern>
    </defs>
    <rect width=""100%"" height=""100%"" fill=""url(#grid)""/>
    
    <!-- 模拟节点 -->
    <rect x=""{startX - 40}"" y=""{startY - 25}"" width=""80"" height=""50"" rx=""5"" fill=""#2C3E50""/>
    <rect x=""{endX - 40}"" y=""{endY - 25}"" width=""80"" height=""50"" rx=""5"" fill=""#2C3E50""/>
    <text x=""{startX}"" y=""{startY + 5}"" text-anchor=""middle"" fill=""white"" font-size=""12"">节点 A</text>
    <text x=""{endX}"" y=""{endY + 5}"" text-anchor=""middle"" fill=""white"" font-size=""12"">节点 B</text>
    
    <!-- 直角连接线 -->
    <path d=""M {startX} {startY} H {midPointX} V {endY} H {endX}"" fill=""none"" stroke=""white"" stroke-width=""2""/>
    
    <!-- 连接点 -->
    <circle cx=""{startX}"" cy=""{startY}"" r=""4"" fill=""#3498DB""/>
    <circle cx=""{endX}"" cy=""{endY}"" r=""4"" fill=""#3498DB""/>
    
    <!-- 标题 -->
    <text x=""250"" y=""30"" text-anchor=""middle"" fill=""#333"" font-size=""16"" font-weight=""bold"">直角连接线预览</text>
</svg>";
    }
}